<template>
    <div id="app">
      <el-form :model="ClasseList" label-width="100px">
        <el-form-item label="班级" prop="name">
          <el-input v-model="ClasseList.name"></el-input>
        </el-form-item>

        <el-form-item label="辅导员">
          <el-select  v-model="ClasseList.cid">
            <el-option v-for="(item,index) in Teacher" :key="index" :lable="item.name" :value="item.id"></el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="学科" >
        <el-input v-model="ClasseList.major"></el-input>
      </el-form-item>
        <el-form-item label="描述" >
        <el-input v-model="ClasseList.description" type="text" rows="5"></el-input>
      </el-form-item>



        <el-form-item>
          <el-button type="primary" @click.prevent="test">保存</el-button>
        </el-form-item>
      </el-form>
    </div>
</template>

<script>
    export default {
      data(){
        return {
          ClasseList:{},
          Teacher:[]
        }
      },
      created() {
        this.axios.get("/teacher/select/").then((resp)=>{
          this.Teacher=resp.data;
        })
      },
      methods:{
        test(){
            this.$confirm("是否确认提交","保存提示").then(()=>{
              this.axios.put("/class/insert",this.ClasseList).then((resp)=>{
                  this.$message.success("保存成功！");
                  this.$router.push("/Class/ClassList")
                });
            });

        }
      },

    }
</script>


<style scoped>

</style>
